home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_02 / allison / offsetof.c < prev    next >
C/C++ Source or Header  |  1994-11-30  |  270b  |  22 lines

  1. LISTING 4 - offsetof exposes alignment within a structure
  2.  
  3. #include <stddef.h>
  4. #include <stdio.h>
  5.  
  6. struct Person
  7. {
  8.      char name[15];
  9.      int age;
  10. };
  11.  
  12. main()
  13. {
  14.      printf("%d\n",offsetof(struct Person, age));
  15.      return 0;
  16. }
  17.  
  18. /* Output:
  19. 16
  20. */
  21.  
  22.